package juc;



import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class P25 {
    public static void main(String[] args) {

        FutureTask<Integer>futureTask=new FutureTask<>(new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                Thread.sleep(100);
                return 123;
            }
        });

        new Thread(futureTask).start();
        while (!futureTask.isDone()){
            System.out.println("wait!!!!");
        }
        try {
            System.out.println("futureTask.get()"+futureTask.get());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
    }

}
